<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
			//匿名函数
			/*window.setTimeout(function(){
				location.replace("https://www.baidu.com");
			},1200);*/
			///var d=new Date();
			//var st=d.getHours()+":"+d.getMinutes()+":"+d.getSeconds();
			//document.write(st);
			function showTime(){
				var d=new Date();
			    var st=d.getHours()+":"+d.getMinutes()+":"+d.getSeconds();
			    //document.write(st);
			    document.getElementById("time").innerHTML=st;
			
			}
			//加载完成再执行
			window.onload=showTime;
			var timer=window.setInterval("showTime()",1000);
			/*window.setInterval(function(){
				var d=new Date();
			    var st=d.getHours()+":"+d.getMinutes()+":"+d.getSeconds();
			    
			    document.getElementById("time").innerHTML=st;
			},5000);*/
			function stopTime(){
				window.clearInterval(timer);
			}
		</script>
	</head>
	<body>
		<div id="time"></div>
		<input type="button" value="停止" onclick="stopTime()"/>
	</body>
</html>
